/*
 * Copyright (c) 2020 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jauker.badgeview.example.view;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.utils.Color;

import com.jauker.badgeview.example.view.tab.TabInfo;

public abstract class AbstractPageView implements PageInfo, TabInfo {
    private static final String TAG = AbstractPageView.class.getCanonicalName();
    protected Ability slice;
    protected Intent intent;
    private String name;
    private int iconId = 0;
    private int iconIdSelected = 0;
    private Component rootView;
    private Color txtColor;

    public AbstractPageView(Ability abilitySlice, String name, Color txtColor) {
        if (abilitySlice != null) {
            this.slice = abilitySlice;
        } else {
            this.slice = new Ability();
        }
        this.name = name;
        this.txtColor = txtColor;
        initView();
    }

    public AbstractPageView(Ability abilitySlice, String str, int iconId, int iconIdSelected, Color txtColor) {
        if (abilitySlice != null) {
            this.slice = abilitySlice;
        } else {
            this.slice = new Ability();
        }
        this.name = str;
        this.iconId = iconId;
        this.iconIdSelected = iconIdSelected;
        this.txtColor = txtColor;
        initView();
    }

    public AbstractPageView(Ability abilitySlice, Color txtColor, Ability abilitySliceDetails) {
        if (abilitySlice != null) {
            this.slice = abilitySlice;
        } else {
            this.slice = new Ability();
        }
        this.name = name;
        this.txtColor = txtColor;
        this.slice = abilitySliceDetails;
    }

    public abstract void initView();

    public Ability getSlice() {
        return this.slice;
    }

    public String getName() {
        return this.name;
    }

    public int getIconId() {
        return this.iconId;
    }

    public void setIconId(int i) {
        this.iconId = i;
    }

    public int getIconIdSelected() {
        return this.iconIdSelected;
    }

    public void setIconIdSelected(int i) {
        this.iconIdSelected = i;
    }

    public Color getTxtColor() {
        return this.txtColor;
    }

    public void setTxtColor(Color txtColor) {
        this.txtColor = txtColor;
    }

    public Component getRootView() {
        return this.rootView;
    }

    public void setRootView(Component component) {
        this.rootView = component;
    }

    public void redirectedView(Intent intent) {
        this.intent = intent;
    }
}